package com.cl.blog.web;

/**
 * @Author 付
 * @Date 2024-03-15 15:35
 * @Version 1.0
 * @description
 * @since 1.0
 */

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.ServletRequestUtils;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author 付
 * @Date 2024-02-27 17:06
 * @Version 1.0
 * @description 分页的类
 * @since 1.0
 */
@Component
public class PageController {
	@Autowired
	HttpServletRequest request;

	public Page getPage() {
		int current = ServletRequestUtils.getIntParameter(request, "current", 1);
		int size = ServletRequestUtils.getIntParameter(request, "size", 10);

		return new Page(current, size);
	}
}
